package com.cos.config;

import com.cos.constant.Sms;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.Queue;
import org.springframework.amqp.core.TopicExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class SmsConfig {

    @Bean
    public TopicExchange getSmsExchange(){
        return new TopicExchange(Sms.SMS_EXCHANGE,true,false);
    }

    @Bean
    public Queue getSmsQueue(){
        return new Queue(Sms.SMS_QUEUE,true,false,false);
    }

    @Bean
    public Binding getSmsBinding(){
      return   BindingBuilder.bind(getSmsQueue()).to(getSmsExchange()).with("goods.sms.*");
    }
}
